home *** CD-ROM | disk | FTP | other *** search
Wrap
(*^ ::[paletteColors = 128; automaticGrouping; currentKernel; fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, L1, e8, 24, "Times"; ; fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, L1, e6, 18, "Times"; ; fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, L1, e6, 14, "Times"; ; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, L1, a20, 18, "Times"; ; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, L1, a15, 14, "Times"; ; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, L1, a12, 12, "Times"; ; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ; fontset = input, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L1, 12, "Courier"; ; fontset = output, output, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; ; fontset = message, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ; fontset = print, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ; fontset = info, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, L1, 12, "Courier"; ; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, L1, 10, "Times"; ; fontset = header, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = Left Header, nohscroll, cellOutline, 12; fontset = footer, inactive, nohscroll, noKeepOnOnePage, preserveAspect, center, M7, L1, 12; fontset = Left Footer, cellOutline, blackBox, 12; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12, "Courier"; ; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12;] :[font = title; inactive; Cclosed; preserveAspect; startGroup; ] Lab 1: Graphs and Derivatives :[font = section; inactive; Cclosed; preserveAspect; startGroup; ] Graphs of Functions :[font = text; inactive; preserveAspect; ] The graph of a function f is the set of pairs (x,y) in the plane for which y = f (x) . Mathematica can plot these points and connect them very quickly to draw the graph of a given function over a given interval of x-values. It does this in response to the Plot command. ;[s] 5:0,0;88,1;99,2;258,3;262,4;271,-1; 5:1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Example :[font = text; inactive; preserveAspect; ] Here is the Plot command to tell Mathematica to graph the function 5+2x-4x^2+x^3 over the interval -1 <= x <= 4 : ;[s] 7:0,0;12,1;16,2;33,3;44,4;67,5;80,6;114,-1; 7:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect; ] Plot[ 5+2x-4x^2+x^3, {x,-1,4} ]; :[font = text; inactive; preserveAspect; endGroup; ] Notice that square brackets [] enclose the information given to the Plot command. Mathematica requires square brackets in all its commands. On the other hand, curly brackets {} are used to enclose the range of values for x. All ranges and lists of numbers are delimited with curly brackets in Mathematica. Also note that the "caret" symbol (Shift-6 on the keyboard) is used to indicate exponents: x^3 means "x cubed," and x^2 means "x squared." Finally, note that multiplication is indicated by juxtaposition: 2x means "2 times x," just as in ordinary algebra. This simple notation does not work when both symbols are numbers or both are variables. In those cases, you must either us parentheses or the asterisk to indicate multiplication: (2)(3) or x*y . Now execute the above Plot command: click on it and press the Enter key. ;[s] 25:0,0;28,1;30,2;68,3;72,4;83,5;94,6;176,7;178,8;223,9;224,10;296,11;307,12;401,13;404,14;426,15;429,16;515,17;517,18;747,19;753,20;757,21;760,22;786,23;790,24;836,-1; 25:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Exercises :[font = text; inactive; preserveAspect; ] Graph the following functions over the indicated domains: :[font = text; inactive; preserveAspect; ] 1. x^2-4, -3 <= x <= 3 ;[s] 3:0,0;4,1;9,2;25,-1; 3:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect; ] 2. 1/x, -2 <= x <= 3 ;[s] 3:0,0;3,1;6,2;23,-1; 3:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect; ] 3. 1/x, -3 <= x <= 3 Mathematica selects points that are evenly distributed in the given interval. So when that interval is symmetric about x=0, the value x=0 will be one of the points that Mathematica attempts to plot. ;[s] 7:0,0;3,1;6,2;27,3;38,4;206,5;217,6;236,-1; 7:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect; ] 4. Exercise 25 on page 141. :[font = text; inactive; preserveAspect; ] 5. Exercise 17on page 185. Write the function as Sqrt[x]/(1+x) . Note that the horizontal axis drawn is not the x-axis in this case. ;[s] 4:0,0;54,1;68,2;73,3;143,-1; 4:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect; ] 6. Example 7 on page 251. Write the function as Log[x]/x . Use the interval 0.1 <= x <= 6 to avoid the vertical asymptote at x=0. ;[s] 4:0,0;53,1;62,2;63,3;142,-1; 4:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect; ] 7. Exercise 35 on page 258. Write the function as x*E^(-x) . ;[s] 3:0,0;55,1;64,2;66,-1; 3:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect; endGroup; endGroup; ] 8. Exercise 39 on page 258. Use the range -1 to 6. :[font = section; inactive; Cclosed; preserveAspect; startGroup; ] Defining Functions :[font = text; inactive; preserveAspect; ] Besides graphing them, we will be applying several other methods of analysis to fuctions. So it is best to define each function explicitly, using the standard symbols of calculus: f, g, h, etc. :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Examples :[font = text; inactive; preserveAspect; ] The following command defines our previous example to be the function f[x]: ;[s] 3:0,0;70,1;74,2;76,-1; 3:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect; ] f[x_] := 5 + 2x - 4x^2 + x^3 :[font = text; inactive; preserveAspect; ] Notice that a function definition requires two special notations: (1) the variable x must be followed with an underscore character _ on the left side of the definition; (2) the definition operator is := , a colon followed by the equals sign. Also remember that Mathematica always uses square brackets [] with functions. ;[s] 11:0,0;84,1;85,2;133,3;134,4;206,5;209,6;268,7;280,8;309,9;311,10;327,-1; 11:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect; ] Now we can use our definition to graph the function. :[font = input; preserveAspect; ] Plot[ f[x], {x,-1,4} ]; :[font = text; inactive; preserveAspect; ] The function f can now be used in many ways: ;[s] 3:0,0;13,1;14,2;44,-1; 3:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect; ] Plot[ -f[x], {x,-2,4} ]; :[font = input; preserveAspect; ] Plot[ f[-x], {x,-4,2} ]; :[font = input; preserveAspect; ] Plot[ f[x]^2,{x,-2,4} ]; :[font = input; preserveAspect; ] Plot[ f[x^2], {x,-2,2} ]; :[font = text; inactive; preserveAspect; ] The Plot command can plot several functions on the same graph: :[font = input; preserveAspect; ] Plot[ {f[x],f[-x]}, {x,-5,5} ]; :[font = input; preserveAspect; endGroup; ] Plot[ {f[x],-f[x]}, {x,-5,5} ]; :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Exercises :[font = text; inactive; preserveAspect; ] Define the function f as x^4-5x^3+8x-6. Then plot each of the following combinations of f in the specified domain: ;[s] 7:0,0;20,1;21,2;25,3;38,4;89,5;90,6;116,-1; 7:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect; ] 1. f[x] for -2 <= x <= 5 ;[s] 3:0,0;3,1;7,2;26,-1; 3:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect; ] 2. -f[x] for -2 <= x <= 5 ;[s] 3:0,0;4,1;9,2;28,-1; 3:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect; ] 3. f[-x] for -5 <= x <= 2 ;[s] 3:0,0;3,1;8,2;27,-1; 3:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect; ] 4. f[x]^2 for -2 <= x <= 5 ;[s] 3:0,0;4,1;10,2;29,-1; 3:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect; ] 5. f[x^2] for -3 <= x <= 3 ;[s] 3:0,0;4,1;10,2;29,-1; 3:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect; ] 6. f[x] and f[-x] for -5 <= x <= 5 ;[s] 5:0,0;4,1;8,2;14,3;19,4;38,-1; 5:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect; endGroup; endGroup; ] 7. f[x] and -f[x] for -2 <= x <= 5 ;[s] 5:0,0;3,1;7,2;13,3;18,4;36,-1; 5:1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = section; inactive; Cclosed; preserveAspect; startGroup; ] Derivatives :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Examples :[font = text; inactive; preserveAspect; ] Mathematica uses the command D to derive derivatives of functions. For example, the derivative of the function x^3-4x^2+2x+5 with respect to x is derived with: ;[s] 8:0,0;11,1;29,2;30,3;112,4;125,5;142,6;143,7;160,-1; 8:1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Courier,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect; ] D[ x^3-4x^2+2x+5, x ] :[font = text; inactive; preserveAspect; ] Notice that Mathematica lists the terms of a polynomial with the higher exponents afetr the lower exponents. If the function is defined with a separate symbol, then you can also use the prime notation to get derivatives: ;[s] 3:0,0;12,1;23,2;221,-1; 3:1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect; ] f[x_] := x^3-4x^2+2x+5 :[font = input; preserveAspect; ] f'[x] :[font = input; preserveAspect; ] f'[x] :[font = input; preserveAspect; ] f''[x] :[font = input; preserveAspect; ] f'''[x] :[font = input; preserveAspect; endGroup; ] f''''[x] :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Exercises :[font = text; inactive; preserveAspect; ] 1. Exercise 4 on page 144. :[font = text; inactive; preserveAspect; ] 2. Exercise 6 on page 144. Use f [x_] := Cos[3x] :[font = text; inactive; preserveAspect; ] 3. Exercise 9(c) on page 144. Use f[x_] := Cot[ Sqrt[x] ] :[font = text; inactive; preserveAspect; ] 4. Exercise 63 on page 309. :[font = text; inactive; preserveAspect; endGroup; endGroup; ] 5. Exercise 72 on page 309. Use f[x_] := x ArcTan[x] - Log[1+x^2]/2 :[font = section; inactive; Cclosed; preserveAspect; startGroup; ] Derivative Rules :[font = text; inactive; preserveAspect; ] This section verifies the derivative rules that you learned in Calculus I. :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Examples :[font = text; inactive; preserveAspect; ] The Power Rule: :[font = input; preserveAspect; ] D[ x^n, x ] :[font = text; inactive; preserveAspect; ] The Multiple Rule: :[font = input; preserveAspect; ] Clear[f]; D[ c*f[x], x ] :[font = text; inactive; preserveAspect; ] The Sum Rule: :[font = input; preserveAspect; ] D[ f[x] + g[x], x ] :[font = text; inactive; preserveAspect; ] The Product Rule: :[font = input; preserveAspect; ] D[ f[x]*g[x], x ] :[font = text; inactive; preserveAspect; ] The Quotient Rule: :[font = input; preserveAspect; ] D[ f[x]/g[x], x ] :[font = input; preserveAspect; ] Simplify[%] :[font = text; inactive; preserveAspect; ] The Chain Rule: :[font = input; preserveAspect; endGroup; ] D[ f[g[x]], x ] :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Exercises :[font = text; inactive; preserveAspect; ] Use the method of this section to establish general derivative rules for each of the following: :[font = text; inactive; preserveAspect; ] 1. f[x]*g[x]*h[x] :[font = text; inactive; preserveAspect; ] 2. f[g[h[x]]] :[font = text; inactive; preserveAspect; endGroup; endGroup; ] 3. 1/f[x] :[font = section; inactive; Cclosed; preserveAspect; startGroup; ] Extremal Problems :[font = text; inactive; preserveAspect; ] Finally, we use the derivatives to find critical points and inflection points. :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Example :[font = text; inactive; preserveAspect; ] Here is our original example: :[font = input; preserveAspect; ] f[x_] := 5 + 2x - 4x^2 + x^3; Plot[ f[x], {x,-1,4}]; :[font = text; inactive; preserveAspect; ] Now use the Solve operation to find where the derivative is zero: :[font = input; preserveAspect; ] Solve[f'[x]==0,x] :[font = text; inactive; preserveAspect; ] Notice that a double equals sign is needed to define an equation. :[font = text; inactive; preserveAspect; ] Unless you ask for a Numerical approximation, Mathematica automatically gives you the exact answers. Their decimal approximations are: :[font = input; preserveAspect; ] N[%] :[font = text; inactive; preserveAspect; ] Check these critical points by clicking on the graph and then using Command-drag. :[font = text; inactive; preserveAspect; ] We have found two x values where f '[x] = 0. It is clear from the graph which is the maximum and which is the minimum. :[font = text; inactive; preserveAspect; ] We could check the function's Y- values to see which is the maximum and which is the minimum: :[font = input; preserveAspect; ] f[x] /. % :[font = text; inactive; preserveAspect; ] The notation "/. %" means to use the previous values. :[font = text; inactive; preserveAspect; ] Finally, we could check the values of the second derivative: :[font = input; preserveAspect; ] f''[x] /. %% :[font = text; inactive; preserveAspect; ] The first is negative, indicating a maximum point. :[font = text; inactive; preserveAspect; ] The inflection points are where the second derivative is 0: :[font = input; preserveAspect; ] Solve[f''[x]==0,x] :[font = input; preserveAspect; endGroup; ] N[%] :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Exercises :[font = text; inactive; preserveAspect; ] 1. Exercise 6 on page 150. :[font = text; inactive; preserveAspect; ] 2. Exercise 16 on page 150. :[font = text; inactive; preserveAspect; ] 3. Exercise 36 on page 258. :[font = text; inactive; preserveAspect; endGroup; endGroup; endGroup; ] 4. Exercise 39 on page 258. ^*)